%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% This file is part of the book
%%
%% Cryptography
%% http://code.google.com/p/crypto-book/
%%
%% Copyright (C) 2007--2010 David R. Kohel <David.Kohel@univmed.fr>
%% Copyright (C) 2010 Minh Van Nguyen <nguyenminh2@gmail.com>
%%
%% See the file COPYING for copying conditions.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% For typesetting algorithms and pseudocode
\usepackage[algochapter,linesnumbered,noend,ruled]{algorithm2e}
\incmargin{1em}
\decmargin{1em}
\Setnlsty{}{}{}  %% don't bold the line numbers
\SetAlTitleFnt{}  %% don't bold the text ``Algorithm'' in the caption
\setalcapskip{5pt}

\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{duerer}
\usepackage{makeidx}

\usepackage[all]{xy}\xyoption{tips}

\usepackage{color}
\usepackage{graphicx}
\usepackage{hyperref}
\hypersetup{
  pdftitle={Cryptography},%
  pdfauthor={David R. Kohel},%
  pdfsubject={cryptography, mathematics},%
  colorlinks=true,%
  linkcolor=black,%
  citecolor=black,%
  urlcolor=black
}

\usepackage{url}

\newcommand{\documentEdition}{\input{tex/version.tex}}
\newcommand{\tmp}{0}
\newcommand{\ignore}[1]{}
\newcommand{\da}{\downarrow}
\newcommand{\bs}{$\backslash$}
\newcommand{\un}{\mbox{\underline{\hspace{2mm}}}}
\newcommand{\xx}{{\tt }}
\newcommand{\Rbox}[1]{%
  \hbox{%
    \begin{minipage}[t]{8mm}%
      \begin{centerline}{#1}%
      \end{centerline}%
    \end{minipage}%
  }%
}

%% Customized page geometry
\textwidth=450pt
\textheight=700pt
\topmargin=-30pt
\oddsidemargin=0.0pt
\evensidemargin=0.0pt

%% Format date in the ISO format 2007 January 17, for example.
\usepackage{datetime}
\newdateformat{isoDateFormat}{%
  \THEYEAR~\monthname[\THEMONTH]~\twodigit{\THEDAY}
}
\isoDateFormat

%% The following is a brute-force way to prevent the headers
%% from getting transformed into all-caps
\renewcommand\MakeUppercase{}

%% For typesetting code listings
\usepackage{listings}
\lstdefinelanguage{Sage}[]{Python}
{morekeywords={False,sage,True},sensitive=true}
\lstset{
  frame=none,
  showtabs=False,
  showspaces=False,
  showstringspaces=False,
  commentstyle={\ttfamily\color{dgreencolor}},
  keywordstyle={\ttfamily\color{dbluecolor}\bfseries},
  stringstyle={\ttfamily\color{dgraycolor}\bfseries},
  language=Sage,
  basicstyle={\fontsize{10pt}{10pt}\ttfamily},
  aboveskip=0.5em,
  belowskip=0.5em,
  %% numbers=left,
  numberstyle=\footnotesize
}
\definecolor{dblackcolor}{rgb}{0.0,0.0,0.0}
\definecolor{dbluecolor}{rgb}{0.01,0.02,0.7}
\definecolor{dgreencolor}{rgb}{0.2,0.4,0.0}
\definecolor{dgraycolor}{rgb}{0.30,0.3,0.30}
\newcommand{\dblue}{\color{dbluecolor}\bf}
\newcommand{\dred}{\color{dredcolor}\bf}
\newcommand{\dblack}{\color{dblackcolor}\bf}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Mathematical fonts
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\G}{\mathbf{G}}
\newcommand{\A}{\mathbf{A}}
\newcommand{\F}{\mathbf{F}}
\newcommand{\T}{\mathbf{T}}
\newcommand{\Q}{\mathbf{Q}}
\newcommand{\Z}{\mathbf{Z}}
\newcommand{\R}{\mathbf{R}}
\newcommand{\FF}{\mathbf{F}}
\renewcommand{\AA}{\mathbf{A}}
\newcommand{\GG}{\mathbf{G}}
\newcommand{\TT}{\mathbf{T}}
\newcommand{\QQ}{\mathbf{Q}}
\newcommand{\CC}{\mathbf{C}}
\newcommand{\ZZ}{\mathbf{Z}}
\newcommand{\RR}{\mathbf{R}}
\newcommand{\PP}{\mathbf{P}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Caligraphic fonts
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\cA}{{\mathcal A}}
\newcommand{\cC}{{\mathcal C}}
\newcommand{\cE}{{\mathcal E}}
\newcommand{\cK}{{\mathcal K}}
\newcommand{\cL}{{\mathcal L}}
\newcommand{\cM}{{\mathcal M}}
\newcommand{\cO}{{\mathcal O}}
\newcommand{\cP}{{\mathcal P}}
\newcommand{\cS}{{\mathcal S}}
\newcommand{\rX}{\hbox{\durmfamily X}}
\newcommand{\rY}{\hbox{\durmfamily Y}}
%\newcommand{\rX}{\hbox{\durmfamily\bfseries X}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Typewriter fonts
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\tA}{{\tt A}}
\newcommand{\ta}{{\tt a}}
\newcommand{\tB}{{\tt B}}
\newcommand{\tb}{{\tt b}}
\newcommand{\tC}{{\tt C}}
\newcommand{\tc}{{\tt c}}
\newcommand{\tD}{{\tt D}}
\newcommand{\tE}{{\tt E}}
\newcommand{\tF}{{\tt F}}
\newcommand{\tG}{{\tt G}}
\newcommand{\tH}{{\tt H}}
\newcommand{\tI}{{\tt I}}
\newcommand{\tJ}{{\tt J}}
\newcommand{\tK}{{\tt K}}
\newcommand{\tL}{{\tt L}}
\newcommand{\tM}{{\tt M}}
\newcommand{\tN}{{\tt N}}
\newcommand{\tO}{{\tt O}}
\newcommand{\tP}{{\tt P}}
\newcommand{\tQ}{{\tt Q}}
\newcommand{\tR}{{\tt R}}
\newcommand{\tS}{{\tt S}}
\newcommand{\tT}{{\tt T}}
\newcommand{\tU}{{\tt U}}
\newcommand{\tV}{{\tt V}}
\newcommand{\tW}{{\tt W}}
\newcommand{\tX}{{\tt X}}
\newcommand{\tY}{{\tt Y}}
\newcommand{\tZ}{{\tt Z}}
\newcommand{\tz}{{\tt z}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Mathematical symbols
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\isom}{\cong}
\newcommand{\dsp}{\displaystyle}
\newcommand{\scr}{\scriptstyle}
\newcommand{\sx}{\hspace{0.265cm}}
\newcommand{\spc}{\hspace{0.42cm}}
\newcommand{\quo}{\overline}
\newcommand{\li}{{\rm li}}
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\meet}{\cap}
\newcommand{\join}{\cup}
\newcommand{\im}{{\rm Im}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Customize existing commands
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\_}{\underline{{\color{white}w}}}  %% a long underscore
\renewcommand{\qed}{\hfill \mbox{\raggedright \rule{0.1in}{0.1in}}}
\renewcommand{\to}{\longrightarrow}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Mathematical functions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareMathOperator{\GCD}{GCD}
%\DeclareMathOperator{\gcd}{gcd}
\DeclareMathOperator{\LCM}{LCM}
\DeclareMathOperator{\lcm}{lcm}
\DeclareMathOperator{\XGCD}{XGCD}
\DeclareMathOperator{\xgcd}{xgcd}
\DeclareMathOperator{\Gal}{Gal}
\DeclareMathOperator{\Nr}{Nr}
\DeclareMathOperator{\Tr}{Tr}
\DeclareMathOperator{\GF}{GF}
\DeclareMathOperator{\End}{End}
\DeclareMathOperator{\Hom}{Hom}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Theorem environments
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{conjecture}[theorem]{Conjecture}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{exercise}{Exercise}[chapter]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% \newcounter{saveenumi}
%% \newcommand{\course}[1]{%
%% \begin{center}\textsc{The University of Sydney}\\
%% \textsc{#1}\end{center}\vspace*{-0.4cm}}
%% \newcommand{\heading}[3]{%
%% \vspace*{-0.2cm}\rule{\linewidth}{\fboxrule}
%% {#1} \hfill
%% \ifthenelse{\boolean{exercise}}{%
%% \ifthenelse{\boolean{solution}}{%
%%   \textbf{Exercises and Solutions for {#2}}}{%
%%   \textbf{Exercises for {#2}}}}{%
%%   \ifthenelse{\boolean{solution}}{%
%%     \textbf{Solutions for {#2}}}{%
%%     \textbf{{#2}}}} \hfill {#3}
%% \rule[6pt]{\linewidth}{\fboxrule}%
%% \vspace*{-0.2cm}%
%% }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% \newboolean{exercise}
%% \newboolean{solution}
%% \newenvironment{solution}[1]{%
%%   %% \ifthenelse{\boolean{solution}}{%
%%   %% \noindent\textit{Solution.}\hspace{\labelsep}\color{rawsienna}{#1}}{}}%
%%   \noindent\textit{Solution.}
%% }
%% {\ifthenelse{\boolean{solution}}{\color{black}}{}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\makeindex
